package com.dingyx.ps.repository;

import com.dingyx.ps.redis.RedisTemplateDao;
import org.springframework.stereotype.Repository;
import java.util.concurrent.TimeUnit;

/**
 * @author dingyuxin
 */
@Repository
public class PayCacheRepository extends RedisTemplateDao {
    /**
     * 获取token信息
     * @param key
     * @return
     */
    public String getToken(String key){
        return getValue().get(key);
    }

    /**
     * 缓存token信息
     * @param key
     * @param value
     * @param expireTime
     */
    public void cacheToken(String key, String value, Long expireTime){
        getValue().set(key, value, expireTime, TimeUnit.SECONDS);
    }
}
